xtset Code Year	
winsor2 CR rEVA RC Cr Si Le TQ Top1 UC DC NC, cut (1 99) replace
outreg2 using 描述性统计.doc,replace sum(log) title(Decriptive statistics)

*主回归
reghdfe CR ESG Cr Si Le TQ Top1, absorb(Year Code)
estimates store reg1	
reghdfe rEVA ESG Cr Si Le TQ Top1, absorb(Year Code)
estimates store reg2
reghdfe RC ESG Cr Si Le TQ Top1, absorb(Year Code)
estimates store reg3
esttab reg1 reg2 reg3 using 主回归1.doc, b(%6.3f) t(%6.3f) nogap compress star(* 0.1 ** 0.05 *** 0.01)  scalar(N r2_a) replace

*稳健性检验

*1.增加遗漏变量
reghdfe CR ESG GL Cr Si Le TQ Top1, absorb(Year Code)
estimates store reg10
esttab reg10 using 增加遗漏变量1.doc, b(%6.3f) t(%6.3f) nogap compress star(* 0.1 ** 0.05 *** 0.01)  scalar(N r2_a) replace

*2.替换变量：
reghdfe ET1 ESG Cr Si Le TQ Top1, absorb(Year Code)
estimates store reg11
esttab reg11 using 替换变量1.doc, b(%6.3f) t(%6.3f) nogap compress star(* 0.1 ** 0.05 *** 0.01)  scalar(N r2_a) replace

*内生性
*1.	PSM
egen MMESG =  median(ESG)
gen TRMT = .
replace TRMT = 1 if ESG > MMESG
replace TRMT = 0 if ESG < MMESG
drop if ESG == MMESG
logit TRMT Le Top1 Si
predict pscore
psmatch2 TRMT (Le Top1 Si), outcome(ET) neighbor(1) common 
pstest Le Top1 Si, both graph
keep if _support == 1
xtreg CR TRMT Cr Si Le TQ Top1, fe
outreg2 using PSM1.doc, word replace

*工具变量法
reghdfe ESG IV Cr Si Le TQ Top1,absorb(Code Year)
outreg2 using 2sls1.doc, replace bdec(3)sdec(3)addstat(F,`e(F)')addtext(Code,Yes,Year, Yes)
ivreghdfe CR Cr Si Le TQ Top1 (ESG = IV),absorb(Code Year)
outreg2 using 2sls1.doc,append bdec(3)sdec(3)addstat(F,`e(F)')addtext(Code, Yes,Year, Yes)

*中介效应
reghdfe UC ESG Cr Si Le TQ Top1, absorb(Year Code)
estimates store reg4
reghdfe CR ESG UC Cr Si Le TQ Top1, absorb(Year Code)
estimates store reg5
reghdfe DC ESG Cr Si Le TQ Top1, absorb(Year Code)
estimates store reg6
reghdfe CR ESG DC Cr Si Le TQ Top1, absorb(Year Code)
 estimates store reg7
reghdfe NC ESG Cr Si Le TQ Top1, absorb(Year Code)
estimates store reg8
reghdfe CR ESG NC Cr Si Le TQ Top1, absorb(Year Code)
estimates store reg9
esttab reg4 reg5 reg6 reg7 reg8 reg9 using 中介效应1.rtf,b(%6.3f) t(%6.3f) nogap compress star(* 0.1 ** 0.05 *** 0.01)  scalar(N r2_a) replace 

*异质性
 reghdfe CR ESG Cr Si Le TQ Top1 if PC_group==0, absorb(Year Code)
estimates store reg14
reghdfe CR ESG Cr Si Le TQ Top1 if PC_group==1, absorb(Year Code)
estimates store reg15
reghdfe CR ESG Cr Si Le TQ Top1 if KU==0, absorb(Year Code)
estimates store reg16
reghdfe CR ESG Cr Si Le TQ Top1 if KU==1, absorb(Year Code)
estimates store reg17
esttab reg14 reg15 reg16 reg17 using 分组异质性1.doc, b(%6.3f) t(%6.3f) nogap compress star(* 0.1 ** 0.05 *** 0.01)  scalar(N r2_a) replace

